﻿@using EasyMon.Common.Values
@using EasyMon.Server.Models
@model ProductsSummary


@helper ToStatusClass(ValueStatus valueStatus)
    {
    switch (valueStatus)
    {
        case ValueStatus.Good:
            @String.Format("good")
       break;

        case ValueStatus.Warning:
            @String.Format("warning")
       break;

        case ValueStatus.Alarm:
        case ValueStatus.Unavailable:
            @String.Format("error")
       break;
    }
}

@foreach (var product in Model.Products)
{
    <fieldset class="enviornment">
    <legend>
       @product.DisplayName.ToUpper()
        <img src="@Url.Content(String.Format("~/Content/Images/Flags/{0}-small.png", product.DisplayName.ToUpper()))" alt="Flag"/>
    </legend>
    
     @foreach (var env in product.Groups)
     {
         <div class="grid_8">
         
            <fieldset class="status @ToStatusClass(@env.Status)">
            <legend>
                @env.DisplayName
            </legend>
            
            @foreach (var m in env.Machines)
            {
                <fieldset class="status @ToStatusClass(@env.Status)">
                 <legend>
                    @m.DisplayName
                </legend>
            
                
                @foreach (var p in m.Processes)
                {
                    <span style="display:block" class="status  @ToStatusClass(@p.Status)">@p.DisplayName</span>
                }
                </fieldset>
             
            }
         </fieldset>

         </div>
     }
</fieldset>


}
